<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>day06_demo04</title>
<script>
	function cal(){
		//获取文本框,并取值:
		var input=document.getElementById("ss");
		var ss=input.value;
		//执行运算
		try{
			input.value=eval(ss);
		}catch(ex){
			input.value="error";
			
		}
		
		
	}		

</script>


</head>
<body>
	<input type="text" id="ss"/>
	<input type="button" value="="
		onclick="cal();"/>
	
</body>
</html>